<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        /* 
        *****
        ****
        ***
        **
        *
         双重for循环，外层控制行(num1),内层控制列(num2).
          i      num2
          0       5
          1       4
          2       3
          3       2
          4       1  
          i + num2 =5
          num2 = 5 - i;
        */
       var num1 = 5;
       var num2 = 0;
       for (var i = 0; i < num1; i++){
           var star = " ";
           for (var j = 0 ; j <5 -i; j++){
               star = star +"*";
           }
           console.log(star);
       }
    </script>
</head>
<body>
    
</body>
</html>